package com.wu.llpsw.effect.buff;

import com.wu.llpsw.yuanli.energy.yuanliManager;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;

//绝灵buff，这时候灵力输出一直为0，不能使出技能
public class jueling_effect extends BaseEffect {

    public jueling_effect(MobEffectCategory type, int color, boolean isInstant) {
        super(type, color, isInstant);
    }

    //buff隔多久生效一次
    @Override
    protected boolean canApplyEffect(int remainingTicks, int level) {
        return remainingTicks % 5 == 0;
    }

    //效果作用用于身上的效果
    @Override
    public void applyEffectTick(LivingEntity entity, int value) {
        if(entity instanceof ServerPlayer){
            Player player=(Player) entity;
            yuanliManager.use(player,-1000);
        }
    }


    //申明是debuff还是buff
    @Override
    public boolean isBeneficial() {
        return true;
    }
}
